<template>
	<view>
		<view class="comment" v-if="commentList.length > 0" v-for="(comment, index) in commentList" :key="comment.id">
			<view class="left"><image :src="comment.user.avatar_url" mode="aspectFill"></image></view>
			<view class="right">
				<view class="top">
					<view class="name">{{ comment.user.name }}</view>
					<view class="like" :class="{ highlight: comment.star }">
						<view class="num">{{ comment.star }}</view>
						<u-icon v-if="!comment.created_at" name="thumb-up" :size="30" color="#9a9a9a"></u-icon>
						<u-icon v-if="comment.created_at" name="thumb-up-fill" :size="30"></u-icon>
					</view>
				</view>
				<view class="content">{{ comment.content }}</view>
				<view class="content">{{ comment.updated_at }}</view>
			</view>
		</view>
		<view class="u-p-t-20" v-if="commentList.length < 1">
			<u-empty text="暂无评论" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		name:"goods-comment",
		props:{
			commentList: {
				type: Array,
				default(){
					return []
				}
			}
		},
		data() {
			return {
			};
		},
		methods: {
		}
	}
</script>

<style lang="scss" scoped>
.comment {
	display: flex;
	padding: 30rpx;
	.left {
		image {
			width: 64rpx;
			height: 64rpx;
			border-radius: 50%;
			background-color: #f2f2f2;
		}
	}
	.right {
		flex: 1;
		padding-left: 20rpx;
		font-size: 30rpx;
		.top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 10rpx;
			.name {
				color: #5677fc;
			}
			.like {
				display: flex;
				align-items: center;
				color: #9a9a9a;
				font-size: 26rpx;
				.num {
					margin-right: 4rpx;
					color: #9a9a9a;
				}
			}
			.highlight {
				color: #5677fc;
				.num {
					color: #5677fc;
				}
			}
		}
		.content {
			margin-bottom: 10rpx;
		}
	}
}
</style>
